package com.hspedu.interface_.InterfaceExercise02;

/**
 * @Author Stringzhua
 * @Date 2024/3/6 14:30
 * description:查看bug,并修改
 */
public class InterfaceExercise02 {
    public static void main(String[] args) {
        new C().pX();
    }
}

interface A {
    int x = 0;//等价于public static  final int x=0;
}

class B {
    int x = 1;//普通属性
}

class C extends B implements A {
    public void pX() {
//        System.out.println("x = " +x);//对x的引用不明确 [Reference to 'x' is ambiguous, both 'B.x' and 'A.x' match]
        //可以明确的指定是哪个x
        //访问接口的x 请使用A.x
        System.out.println("x = " + A.x);//错误修改后
        //访问类的x 请使用super.x
        System.out.println("super.x = " + super.x);//错误修改后
        System.out.println(A.x + "  super.x = " + super.x);
    }
}
